package cn.edu.cdut.controller;

import cn.edu.cdut.dto.Major;
import cn.edu.cdut.dto.Majors;
import cn.edu.cdut.dto.MyRes;
import cn.edu.cdut.service.SpecialitySetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Author  kobe
 * Created on 2017-05-27-9:52
 */
@RestController
public class SpecSetController {

        @Autowired
        private SpecialitySetService specialitySetService;

        @GetMapping("/getAllSpeciality")
        public MyRes getAllSpeciality() {
                return specialitySetService.getAllSpeciality();
        }

        @PostMapping("/setSpeciality")
        public MyRes setSpeciality(@RequestBody Majors majors) {
                return specialitySetService.setSpeciality(majors);
        }

        @PostMapping("/updateSpeciality")
        public MyRes updateSpeciality(@RequestBody Major major) {
                return specialitySetService.updateSpeciality(major);
        }

        @PostMapping("/removeSpeciality")
        public MyRes removeSpeciality(@RequestBody Major major) {
                return specialitySetService.removeSpeciality(major);
        }

        @PostMapping("/setTotalPeople")
        public MyRes setTotalPeople(@RequestBody Major major) {
                return specialitySetService.setTotalPeople(major);
        }

        @GetMapping("/resetMajorState")
        public MyRes resetMajorState() {
                return specialitySetService.resetState();
        }

        @GetMapping("/getSpecOption")
        public MyRes getSpecOption(@RequestParam String subject) {
                return specialitySetService.getSpecOption(subject);
        }

}
